//Copyright (c) 2006-2007 Microsoft Corporation.  All rights reserved
using System;

using InvocationFramework.Common.Interfaces;

namespace InvocationFramework.Core.ProxyFactory
{
    /// <summary>
    /// Estrategia de generacion de proxies usando Remoting TransparentProxy
    /// </summary>
    /// <author>Rodolfo Finochietti 03/02/2006 23.25</author>
    public class RemotingProxyGenerator : IProxyGenerator
    {
        #region IProxyGenerator Members

        /// <summary>
        /// Construye un proxy del tipo especificado en el parametro
        /// </summary>
        /// <typeparam name="T">Tipo del proxy a generar</typeparam>
        /// <param name="serviceName">Nombre del servicio al que se va a invocar utilizando el proxy generado</param>
        /// <returns>Un proxy del tipo especificado</returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter" )]
        public T BuildProxy<T>( string serviceName ) where T : class
        {
            RemotingProxyInterceptor<T> interceptor = new RemotingProxyInterceptor<T>( serviceName );

            return interceptor.CreateProxy( );
        }

        #endregion
    }
}
